<div id="request_list">
<?php foreach($request as $user){?>
		<img src="<?php echo $user['photo_path'];?>" width="80" height="80" class="avater"/>
		<a href="<?php echo base_url();?>friend?id=<?php echo $user['id'];?>" ><?php echo $user['name']; ?></a>
		<br>
		<label><?php echo $user['note'];?></label>
		<label><?php echo $user['time'];?></label>
		<div id="<?php echo $user["id"];?>">
			<input type="submit" onclick='concept("<?php echo $user["id"];?>");' value="通过申请"></input>
			<input type="submit" onclick='refuse("<?php echo $user["id"];?>");' value="忽略"></input>
		</div>
		<br>
<?php }?>
	<?php echo $this->pagination->create_links(); ?>
	</div>


<script type="text/javascript">

	var xmlHttp_concept;
	function concept(id){
		xmlHttp_concept=GetXmlHttpObject();
		send_concept_post_data(id);	
	}

	function send_concept_post_data(id){
		
		if (xmlHttp_concept==null)
		  {
		  	alert ("Browser does not support HTTP Request");
		  	return;
		  }
		 var url="concept_friend?id="+id;
		 xmlHttp_concept.onreadystatechange=conceptstateChanged;
		 xmlHttp_concept.open("GET",url,true);
		 //xmlHttp_concept.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=utf-8");
		 xmlHttp_concept.send(null);
	}

	function conceptstateChanged()
	{  
	  	if (xmlHttp_concept.readyState==4 || xmlHttp_concept.readyState=="complete")
	 	{
	 	  	
	 	  	if(xmlHttp_concept.responseText){
	 	  		$("#"+xmlHttp_concept.responseText).hide();
	 	  		flash_success_message("通过申请！");
	 	  	} 
	   	} 
	}

	var xmlHttp_refuse;
	function refuse(id){
		xmlHttp_refuse=GetXmlHttpObject();
		send_refuse_post_data(id);	
	}

	function send_refuse_post_data(id){
		if (xmlHttp_refuse==null)
		  {
		  	alert ("Browser does not support HTTP Request");
		  	return;
		  }
		 var url="refuse_friend?id="+id;
		 xmlHttp_refuse.onreadystatechange=refusestateChanged;
		 xmlHttp_refuse.open("GET",url,true);
		 //xmlHttp_concept.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=utf-8");
		 xmlHttp_refuse.send(null);
	}

	function refusestateChanged()
	{  
	  	if (xmlHttp_refuse.readyState==4 || xmlHttp_refuse.readyState=="complete")
	 	{
	 	  	
	 	  	if(xmlHttp_refuse.responseText){
	 	  		$("#"+xmlHttp_refuse.responseText).hide();
	 	  		flash_success_message("已经忽略！");
	 	  	} 
	   	} 
	}
	
</script>

